package cn.stylefeng.guns.modular.business.frequency.orderpick.mapper;

import cn.stylefeng.guns.modular.business.frequency.orderpick.model.param.PickCarExcludeDTO;
import cn.stylefeng.guns.modular.business.frequency.orderpick.model.param.PickDTO;
import cn.stylefeng.guns.modular.business.frequency.orderpick.model.param.PickRecordContractVO;
import cn.stylefeng.guns.modular.business.frequency.orderpick.model.result.PkgOrderPick;
import cn.stylefeng.guns.modular.business.frequency.ordersub.model.param.OrderDTO;
import cn.stylefeng.guns.modular.business.frequency.ordersub.model.result.PkgPick;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.stylefeng.guns.modular.business.frequency.orderpick.entity.OrderPick;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 提车记录表 Mapper 接口
 *
 * @author yujie
 * @date 2023/05/09 17:16
 */
public interface OrderPickMapper extends BaseMapper<OrderPick> {

    @Update("update tt_order_pick set company_id = #{companyId} where settlement_id = #{linkmanId}")
    void updateCompanyIdByLinkmanId(@Param("companyId") Long companyId, @Param("linkmanId") Long linkmanId);

    /**根据订单ID 获取提车详情 */
    PkgPick getPkgPickDetail(@Param("orderId") Long orderId);

    /**提车待处理列表*/
    Page<PkgOrderPick> getWaiDealOrderList(@Param("page") Page<Object> defaultPage, @Param("orderDTO") PickDTO orderDTO, @Param("tenantId") Long tenantId);
    Long getWaiDealOrderNum( @Param("orderDTO") PickDTO orderDTO, @Param("tenantId") Long tenantId);

    PkgOrderPick getWaiDealOrderDetailList(@Param("orderId") Long orderId);

    List<String> getStartCodes(@Param("orderDTO") OrderDTO orderDTO, @Param("tenantId") Long tenantId);

    List<String> getDestinationCodes(@Param("orderDTO") OrderDTO orderDTO, @Param("tenantId") Long tenantId);

    /** 已完成提车列表 */
    Page<PkgOrderPick> getFinishOrderList(@Param("page") Page<Object> defaultPage, @Param("orderDTO") PickDTO orderDTO,@Param("tenantId") Long tenantId);

    /** 添加待提车弹框筛选 */
    List<PkgOrderPick> getWaitPickExcludeList(@Param("pickCarExcludeDTO") PickCarExcludeDTO pickCarExcludeDTO, @Param("tenantId") Long tenantId);

    /**
     * 待验车分页列表
     * @param page
     * @param orderDTO
     * @return
     */
    Page<PkgOrderPick> getWaiVerifyOrderList(@Param("page") Page<Object> page, @Param("orderDTO") OrderDTO orderDTO,@Param("tenantId") Long tenantId);
    Long getWaiVerifyOrderNum( @Param("orderDTO") OrderDTO orderDTO,@Param("tenantId") Long tenantId);


    /**根据orderId查询提车记录信息 生成提车单*/
    PkgOrderPick billOfLadingGeneration( @Param("orderDTO") PickRecordContractVO orderDTO, @Param("tenantId") Long tenantId);

}
